// object 键值对去重
function unique(array) {
  var obj = {};
  return array.filter(function(item, index, array) {
    return obj.hasOwnProperty(typeof item + JSON.stringify(item)) ? false : (obj[typeof item + JSON.stringify(item)] = true)
  })
}

var array = [1, 1, '1', '1', null, null, undefined, undefined, new String('1'), new String('1'), /a/, /a/, NaN, NaN,{a:1},{a:1}];
console.log(unique(array)); 
// [ 1, '1', null, undefined, [String: '1'], /a/, NaN ]

// // 先执行typeof 然后再字符串拼接
// console.log(typeof (typeof 1 + 1)); // string

// console.log(typeof(JSON.stringify({value:2}))); // string
